]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
boxPointer: Do not mute key events while showing
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 17 Nov 2021 23:18:09 +0000 (00:18 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 29 Jan 2022 00:16:29 +0000 (01:16 +0100)
We want to mute things like pointers hovering the BoxPointer while
it does open. However keyboard events should still be handled
promptly.

Since Clutter.grab() will involve different actors being grabbed
and focused, this will have some more presence, e.g. when navigating
panel menus. We want to be able to navigate outside a menu while it
is still being shown.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>

js/ui/boxpointer.js

index be9c57ce03d83fb47e56915662d189086837a65c..1db8e56afb4e31c1c18467764845b5c054ed029b 100644 (file)
@@ -46,6 +46,7 @@ var BoxPointer = GObject.registerClass({
         this.add_actor(this._border);
         this.set_child_above_sibling(this.bin, this._border);
         this._sourceAlignment = 0.5;
+        this._muteKeys = true;
         this._muteInput = true;
 
         this.connect('notify::visible', () => {
@@ -58,8 +59,16 @@ var BoxPointer = GObject.registerClass({
         this.connect('destroy', this._onDestroy.bind(this));
     }
 
-    vfunc_captured_event() {
-        if (this._muteInput)
+    vfunc_captured_event(event) {
+        if (event.type() === Clutter.EventType.ENTER ||
+            event.type() === Clutter.EventType.LEAVE)
+            return Clutter.EVENT_PROPAGATE;
+
+        let mute = event.type() === Clutter.EventType.KEY_PRESS ||
+            event.type() === Clutter.EventType.KEY_RELEASE
+            ? this._muteKeys : this._muteInput;
+
+        if (mute)
             return Clutter.EVENT_STOP;
 
         return Clutter.EVENT_PROPAGATE;
@@ -86,6 +95,7 @@ var BoxPointer = GObject.registerClass({
         else
             this.opacity = 255;
 
+        this._muteKeys = false;
         this.show();
 
         if (animate & PopupAnimation.SLIDE) {
@@ -148,6 +158,7 @@ var BoxPointer = GObject.registerClass({
         }
 
         this._muteInput = true;
+        this._muteKeys = true;
 
         this.remove_all_transitions();
         this.ease({